<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta name="Content-Type" content="text/html; charset=UTF-8" />
<title>Class: Sass::Script::Color</title>
<link rel="stylesheet" href="style.css" tppabs="http://sass-lang.com/docs/yardoc/css/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="common.css" tppabs="http://sass-lang.com/docs/yardoc/css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '../..';
  if (relpath != '') relpath += '/';
</script>
<script type="text/javascript" charset="utf-8" src="jquery.js" tppabs="http://sass-lang.com/docs/yardoc/js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="app.js" tppabs="http://sass-lang.com/docs/yardoc/js/app.js"></script>

  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="_index.html" tppabs="http://sass-lang.com/docs/yardoc/_index.html">Index (C)</a> &raquo; 
    <span class='title'><a href="Sass-1.html" tppabs="http://sass-lang.com/docs/yardoc/Sass.html" title="Sass (module)">Sass</a></span> &raquo; <span class='title'><a href="Script.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script.html" title="Sass::Script (module)">Script</a></span>
     &raquo; 
    <span class="title">Color</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="javascript:if(confirm(%27http://sass-lang.com/docs/yardoc/Sass/Script/.  \n\nThis file was not retrieved by Teleport Pro, because the server reports that this file cannot be found.  \n\nDo you want to open it from the server?%27))window.location=%27http://sass-lang.com/docs/yardoc/Sass/Script/.%27" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  <a id="class_list_link" href="#">Class List</a>
  <a id="method_list_link" href="#">Method List</a>
  <a id ="file_list_link" href="#">File List</a>
</div>

      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><h1>Class: Sass::Script::Color 
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName"><a href="Literal.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html" title="Sass::Script::Literal (class)">Literal</a></span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next"><a href="Node-1.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html" title="Sass::Script::Node (class)">Node</a></li>
          
            <li class="next"><a href="Literal.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html" title="Sass::Script::Literal (class)">Literal</a></li>
          
            <li class="next">Sass::Script::Color</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
      <dt class="r2">Extends:</dt>
      <dd class="r2"><a href="Util.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Util.html" title="Sass::Util (module)">Sass::Util</a></dd>
      
    
  
    
  
  
    <dt class="r1 last">Defined in:</dt>
    <dd class="r1 last">/var/www/sass-pages/.sass/lib/sass/script/color.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>A SassScript object representing a CSS color.</p>

<p>A color may be represented internally as RGBA, HSLA, or both. It&#8217;s originally represented as whatever its input is; if it&#8217;s created with RGB values, it&#8217;s represented as RGBA, and if it&#8217;s created with HSL values, it&#8217;s represented as HSLA. Once a property is accessed that requires the other representation &#8211; for example, <tt><a href="#red-instance_method" title="Sass::Script::Color#red (method)">#red</a></tt> for an HSL color &#8211; that component is calculated and cached.</p>

<p>The alpha channel of a color is independent of its RGB or HSL representation. It&#8217;s always stored, as 1 if nothing else is specified. If only the alpha channel is modified using <tt><a href="#with-instance_method" title="Sass::Script::Color#with (method)">#with</a></tt>, the cached RGB and HSL values are retained.</p>

  </div>
</div>
<div class="tags">
  
</div>
  <h2>Constant Summary</h2>
  


  
  
  
  
  
  
  
  

  <h2>Instance Method Summary</h2>

  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#alpha-instance_method" title="#alpha (instance method)">- (Fixnum) <strong>alpha</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">The alpha channel (opacity) of the color.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#alpha%3F-instance_method" title="#alpha? (instance method)">- (Boolean) <strong>alpha?</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">Returns whether this color object is translucent; that is, whether the alpha channel is non-1.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#blue-instance_method" title="#blue (instance method)">- (Fixnum) <strong>blue</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">The blue component of the color.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#div-instance_method" title="#div (instance method)">- (Color) <strong>div</strong>(other) </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">The SassScript <code>/</code> operation.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#eq-instance_method" title="#eq (instance method)">- (Bool) <strong>eq</strong>(other) </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">The SassScript <code>==</code> operation.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#green-instance_method" title="#green (instance method)">- (Fixnum) <strong>green</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">The green component of the color.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#hsl-instance_method" title="#hsl (instance method)">- (Array&lt;Fixnum&gt;) <strong>hsl</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">Returns the hue, saturation, and lightness components of the color.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#hue-instance_method" title="#hue (instance method)">- (Numeric) <strong>hue</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">The hue component of the color.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">- (Color) <strong>initialize</strong>(attrs, allow_both_rgb_and_hsl = false) </a>
    

    
  </span>
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  

  
    <span class="summary_desc">Constructs an RGB or HSL color object, optionally with an alpha channel.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#inspect-instance_method" title="#inspect (instance method)">- (String) <strong>inspect</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">Returns a string representation of the color.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#lightness-instance_method" title="#lightness (instance method)">- (Numeric) <strong>lightness</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">The lightness component of the color.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#minus-instance_method" title="#minus (instance method)">- (Color) <strong>minus</strong>(other) </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">The SassScript <code>-</code> operation.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#mod-instance_method" title="#mod (instance method)">- (Color) <strong>mod</strong>(other) </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">The SassScript <code>%</code> operation.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#plus-instance_method" title="#plus (instance method)">- (Color) <strong>plus</strong>(other) </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">The SassScript <code>+</code> operation.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#red-instance_method" title="#red (instance method)">- (Fixnum) <strong>red</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">The red component of the color.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#rgb-instance_method" title="#rgb (instance method)">- (Array&lt;Fixnum&gt;) <strong>rgb</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">Returns the red, green, and blue components of the color.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#saturation-instance_method" title="#saturation (instance method)">- (Numeric) <strong>saturation</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">The saturation component of the color.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#times-instance_method" title="#times (instance method)">- (Color) <strong>times</strong>(other) </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">The SassScript <code>*</code> operation.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_s-instance_method" title="#to_s (instance method)">- (String) <strong>to_s</strong>(opts = {}) </a>
    

    
      (also: #to_sass)
    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">Returns a string representation of the color.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#with-instance_method" title="#with (instance method)">- (Color) <strong>with</strong>(attrs) </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">Returns a copy of this color with one or more channels changed.</span>
  
</li>

    
  </ul>

  
  
  
  
  
  <h3 class="inherited">Methods inherited from <a href="Literal.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html" title="Sass::Script::Literal (class)">Literal</a></h3>
  <p class="inherited"><a href="Literal.html#%3D%3D-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#%3D%3D-instance_method" title="Sass::Script::Literal#== (method)">#==</a>, <a href="Literal.html#_perform-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#_perform-instance_method" title="Sass::Script::Literal#_perform (method)">#_perform</a>, <a href="Literal.html#assert_int%21-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#assert_int%21-instance_method" title="Sass::Script::Literal#assert_int! (method)">#assert_int!</a>, <a href="Literal.html#children-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#children-instance_method" title="Sass::Script::Literal#children (method)">#children</a>, <a href="Literal.html#comma-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#comma-instance_method" title="Sass::Script::Literal#comma (method)">#comma</a>, <a href="Literal.html#deep_copy-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#deep_copy-instance_method" title="Sass::Script::Literal#deep_copy (method)">#deep_copy</a>, <a href="Literal.html#neq-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#neq-instance_method" title="Sass::Script::Literal#neq (method)">#neq</a>, <a href="Literal.html#null%3F-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#null%3F-instance_method" title="Sass::Script::Literal#null? (method)">#null?</a>, <a href="Literal.html#options-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#options-instance_method" title="Sass::Script::Literal#options (method)">#options</a>, <a href="Literal.html#single_eq-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#single_eq-instance_method" title="Sass::Script::Literal#single_eq (method)">#single_eq</a>, <a href="Literal.html#space-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#space-instance_method" title="Sass::Script::Literal#space (method)">#space</a>, <a href="Literal.html#to_a-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#to_a-instance_method" title="Sass::Script::Literal#to_a (method)">#to_a</a>, <a href="Literal.html#to_bool-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#to_bool-instance_method" title="Sass::Script::Literal#to_bool (method)">#to_bool</a>, <a href="Literal.html#to_i-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#to_i-instance_method" title="Sass::Script::Literal#to_i (method)">#to_i</a>, <a href="Literal.html#unary_div-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#unary_div-instance_method" title="Sass::Script::Literal#unary_div (method)">#unary_div</a>, <a href="Literal.html#unary_minus-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#unary_minus-instance_method" title="Sass::Script::Literal#unary_minus (method)">#unary_minus</a>, <a href="Literal.html#unary_not-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#unary_not-instance_method" title="Sass::Script::Literal#unary_not (method)">#unary_not</a>, <a href="Literal.html#unary_plus-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#unary_plus-instance_method" title="Sass::Script::Literal#unary_plus (method)">#unary_plus</a></p>

  
  
  
  
  
  <h3 class="inherited">Methods inherited from <a href="Node-1.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html" title="Sass::Script::Node (class)">Node</a></h3>
  <p class="inherited"><a href="Node-1.html#_perform-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html#_perform-instance_method" title="Sass::Script::Node#_perform (method)">#_perform</a>, <a href="Node-1.html#children-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html#children-instance_method" title="Sass::Script::Node#children (method)">#children</a>, <a href="Node-1.html#dasherize-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html#dasherize-instance_method" title="Sass::Script::Node#dasherize (method)">#dasherize</a>, <a href="Node-1.html#deep_copy-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html#deep_copy-instance_method" title="Sass::Script::Node#deep_copy (method)">#deep_copy</a>, <a href="Node-1.html#opts-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html#opts-instance_method" title="Sass::Script::Node#opts (method)">#opts</a>, <a href="Node-1.html#perform-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Node.html#perform-instance_method" title="Sass::Script::Node#perform (method)">#perform</a></p>
<div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <p class="signature first" id="initialize-instance_method">
  
    
      <span class="overload">- <strong>initialize</strong>(attrs) </span>
    
      <span class="overload">- <strong>initialize</strong>(rgba) </span>
    
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Constructs an RGB or HSL color object, optionally with an alpha channel.</p>

<p>The RGB values must be between 0 and 255. The saturation and lightness values must be between 0 and 100. The alpha value must be between 0 and 1.</p>

  </div>
</div>
<div class="tags">
  
  <h3>Overloads:</h3>
  <ul class="overload">
    
      
      <li class="overload_item">
        <span class="signature">- <strong>initialize</strong>(attrs) </span>
        <div class="docstring">
  <div class="discussion">
    <p>The attributes are specified as a hash. This hash must contain either <code>:hue</code>, <code>:saturation</code>, and <code>:value</code> keys, or <code>:red</code>, <code>:green</code>, and <code>:blue</code> keys. It cannot contain both HSL and RGB keys. It may also optionally contain an <code>:alpha</code> key.</p>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt>{Symbol =&gt; Numeric}</tt>)</span>
      
      
        <span class='name'>attrs</span>
      
      
      
        &mdash;
        A hash of color attributes to values
      
    </li>
  
</ul>
<h3>Raises:</h3>
<ul class="raise">
  
    <li>
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
      
        &mdash;
        if not enough attributes are specified, or both RGB and HSL attributes are specified
      
    </li>
  
</ul>

</div>
      </li>
    
      
      <li class="overload_item">
        <span class="signature">- <strong>initialize</strong>(rgba) </span>
        <div class="docstring">
  <div class="discussion">
    <p>The attributes are specified as an array. This overload only supports RGB or RGBA colors.</p>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt>Array&lt;Numeric&gt;</tt>)</span>
      
      
        <span class='name'>rgba</span>
      
      
      
        &mdash;
        A three- or four-element array of the red, green, blue, and optionally alpha values (respectively) of the color
      
    </li>
  
</ul>
<h3>Raises:</h3>
<ul class="raise">
  
    <li>
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
      
        &mdash;
        if not enough attributes are specified
      
    </li>
  
</ul>

</div>
      </li>
    
  </ul>
<h3>Raises:</h3>
<ul class="raise">
  
    <li>
      
        <span class='type'>(<tt><a href="SyntaxError.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/SyntaxError.html" title="Sass::SyntaxError (class)">Sass::SyntaxError</a></tt>)</span>
      
      
      
      
        &mdash;
        if any color value isn&#8217;t in the specified range
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 202</span>

def initialize(attrs, allow_both_rgb_and_hsl = false)
  super(nil)

  if attrs.is_a?(Array)
    unless (3..4).include?(attrs.size)
      raise ArgumentError.new("Color.new(array) expects a three- or four-element array")
    end

    red, green, blue = attrs[0...3].map {|c| c.to_i}
    @attrs = {:red => red, :green => green, :blue => blue}
    @attrs[:alpha] = attrs[3] ? attrs[3].to_f : 1
  else
    attrs = attrs.reject {|k, v| v.nil?}
    hsl = [:hue, :saturation, :lightness] & attrs.keys
    rgb = [:red, :green, :blue] & attrs.keys
    if !allow_both_rgb_and_hsl && !hsl.empty? && !rgb.empty?
      raise ArgumentError.new("Color.new(hash) may not have both HSL and RGB keys specified")
    elsif hsl.empty? && rgb.empty?
      raise ArgumentError.new("Color.new(hash) must have either HSL or RGB keys specified")
    elsif !hsl.empty? && hsl.size != 3
      raise ArgumentError.new("Color.new(hash) must have all three HSL values specified")
    elsif !rgb.empty? && rgb.size != 3
      raise ArgumentError.new("Color.new(hash) must have all three RGB values specified")
    end

    @attrs = attrs
    @attrs[:hue] %= 360 if @attrs[:hue]
    @attrs[:alpha] ||= 1
  end

  [:red, :green, :blue].each do |k|
    next if @attrs[k].nil?
    @attrs[k] = @attrs[k].to_i
    Sass::Util.check_range("#{k.to_s.capitalize} value", 0..255, @attrs[k])
  end

  [:saturation, :lightness].each do |k|
    next if @attrs[k].nil?
    value = Number.new(@attrs[k], ['%']) # Get correct unit for error messages
    @attrs[k] = Sass::Util.check_range("#{k.to_s.capitalize}", 0..100, value, '%')
  end

  @attrs[:alpha] = Sass::Util.check_range("Alpha channel", 0..1, @attrs[:alpha])
end</pre>
    </td>
  </tr>
</table>
</div>
  
</div>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="alpha-instance_method">
  
    - (<tt>Fixnum</tt>) <strong>alpha</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>The alpha channel (opacity) of the color. This is 1 unless otherwise defined.</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>Fixnum</tt>)</span>
      
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


299
300
301</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 299</span>

def alpha
  @attrs[:alpha]
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="alpha?-instance_method">
  
    - (<tt>Boolean</tt>) <strong>alpha?</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Returns whether this color object is translucent; that is, whether the alpha channel is non-1.</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


307
308
309</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 307</span>

def alpha?
  alpha < 1
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="blue-instance_method">
  
    - (<tt>Fixnum</tt>) <strong>blue</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>The blue component of the color.</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>Fixnum</tt>)</span>
      
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


266
267
268
269</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 266</span>

def blue
  hsl_to_rgb!
  @attrs[:blue]
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="div-instance_method">
  
    - (<tt><a href="" title="Sass::Script::Color (class)">Color</a></tt>) <strong>div</strong>(other) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>The SassScript <code>/</code> operation. Its functionality depends on the type of its argument:</p>

<dl>
<dt><tt><a href="Number.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Number.html" title="Sass::Script::Number (class)">Number</a></tt></dt>

<dd>Divides each of the RGB color channels by the number.</dd>

<dt><tt><a href="" title="Sass::Script::Color (class)">Color</a></tt></dt>

<dd>Divides each of this color&#8217;s RGB color channels by the other color&#8217;s.</dd>

<dt><tt><a href="Literal.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html" title="Sass::Script::Literal (class)">Literal</a></tt></dt>

<dd>See <tt><a href="Literal.html#div-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#div-instance_method" title="Sass::Script::Literal#div (method)">Literal#div</a></tt>.</dd>
</dl>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt><a href="Literal.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html" title="Sass::Script::Literal (class)">Literal</a></tt>)</span>
      
      
        <span class='name'>other</span>
      
      
      
        &mdash;
        The right-hand side of the operator
      
    </li>
  
</ul>
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt><a href="" title="Sass::Script::Color (class)">Color</a></tt>)</span>
      
      
      
      
        &mdash;
        The resulting color
      
    </li>
  
</ul>
<h3>Raises:</h3>
<ul class="raise">
  
    <li>
      
        <span class='type'>(<tt><a href="SyntaxError.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/SyntaxError.html" title="Sass::SyntaxError (class)">Sass::SyntaxError</a></tt>)</span>
      
      
      
      
        &mdash;
        if <code>other</code> is a number with units
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


461
462
463
464
465
466
467</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 461</span>

def div(other)
  if other.is_a?(Sass::Script::Number) || other.is_a?(Sass::Script::Color)
    piecewise(other, :/)
  else
    super
  end
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="eq-instance_method">
  
    - (<tt><a href="Bool.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Bool.html" title="Sass::Script::Bool (class)">Bool</a></tt>) <strong>eq</strong>(other) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>The SassScript <code>==</code> operation. <strong>Note that this returns a <tt><a href="Bool.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Bool.html" title="Sass::Script::Bool (class)">Sass::Script::Bool</a></tt> object, not a Ruby boolean</strong>.</p>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt><a href="Literal.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html" title="Sass::Script::Literal (class)">Literal</a></tt>)</span>
      
      
        <span class='name'>other</span>
      
      
      
        &mdash;
        The right-hand side of the operator
      
    </li>
  
</ul>
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt><a href="Bool.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Bool.html" title="Sass::Script::Bool (class)">Bool</a></tt>)</span>
      
      
      
      
        &mdash;
        True if this literal is the same as the other, false otherwise
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


334
335
336
337</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 334</span>

def eq(other)
  Sass::Script::Bool.new(
    other.is_a?(Color) && rgb == other.rgb && alpha == other.alpha)
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="green-instance_method">
  
    - (<tt>Fixnum</tt>) <strong>green</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>The green component of the color.</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>Fixnum</tt>)</span>
      
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


258
259
260
261</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 258</span>

def green
  hsl_to_rgb!
  @attrs[:green]
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="hsl-instance_method">
  
    - (<tt>Array&lt;Fixnum&gt;</tt>) <strong>hsl</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Returns the hue, saturation, and lightness components of the color.</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>Array&lt;Fixnum&gt;</tt>)</span>
      
      
      
      
        &mdash;
        A frozen three-element array of the hue, saturation, and lightness values (respectively) of the color
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


323
324
325</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 323</span>

def hsl
  [hue, saturation, lightness].freeze
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="hue-instance_method">
  
    - (<tt>Numeric</tt>) <strong>hue</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>The hue component of the color.</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>Numeric</tt>)</span>
      
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


274
275
276
277</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 274</span>

def hue
  rgb_to_hsl!
  @attrs[:hue]
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="inspect-instance_method">
  
    - (<tt><a href="String.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/String.html" title="Sass::Script::String (class)">String</a></tt>) <strong>inspect</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Returns a string representation of the color.</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt><a href="String.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/String.html" title="Sass::Script::String (class)">String</a></tt>)</span>
      
      
      
      
        &mdash;
        The hex value
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


505
506
507</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 505</span>

def inspect
  alpha? ? rgba_str : hex_str
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="lightness-instance_method">
  
    - (<tt>Numeric</tt>) <strong>lightness</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>The lightness component of the color.</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>Numeric</tt>)</span>
      
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


290
291
292
293</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 290</span>

def lightness
  rgb_to_hsl!
  @attrs[:lightness]
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="minus-instance_method">
  
    - (<tt><a href="" title="Sass::Script::Color (class)">Color</a></tt>) <strong>minus</strong>(other) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>The SassScript <code>-</code> operation. Its functionality depends on the type of its argument:</p>

<dl>
<dt><tt><a href="Number.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Number.html" title="Sass::Script::Number (class)">Number</a></tt></dt>

<dd>Subtracts the number from each of the RGB color channels.</dd>

<dt><tt><a href="" title="Sass::Script::Color (class)">Color</a></tt></dt>

<dd>Subtracts each of the other color&#8217;s RGB color channels from this color&#8217;s.</dd>

<dt><tt><a href="Literal.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html" title="Sass::Script::Literal (class)">Literal</a></tt></dt>

<dd>See <tt><a href="Literal.html#minus-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#minus-instance_method" title="Sass::Script::Literal#minus (method)">Literal#minus</a></tt>.</dd>
</dl>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt><a href="Literal.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html" title="Sass::Script::Literal (class)">Literal</a></tt>)</span>
      
      
        <span class='name'>other</span>
      
      
      
        &mdash;
        The right-hand side of the operator
      
    </li>
  
</ul>
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt><a href="" title="Sass::Script::Color (class)">Color</a></tt>)</span>
      
      
      
      
        &mdash;
        The resulting color
      
    </li>
  
</ul>
<h3>Raises:</h3>
<ul class="raise">
  
    <li>
      
        <span class='type'>(<tt><a href="SyntaxError.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/SyntaxError.html" title="Sass::SyntaxError (class)">Sass::SyntaxError</a></tt>)</span>
      
      
      
      
        &mdash;
        if <code>other</code> is a number with units
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


418
419
420
421
422
423
424</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 418</span>

def minus(other)
  if other.is_a?(Sass::Script::Number) || other.is_a?(Sass::Script::Color)
    piecewise(other, :-)
  else
    super
  end
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="mod-instance_method">
  
    - (<tt><a href="" title="Sass::Script::Color (class)">Color</a></tt>) <strong>mod</strong>(other) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>The SassScript <code>%</code> operation. Its functionality depends on the type of its argument:</p>

<dl>
<dt><tt><a href="Number.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Number.html" title="Sass::Script::Number (class)">Number</a></tt></dt>

<dd>Takes each of the RGB color channels module the number.</dd>

<dt><tt><a href="" title="Sass::Script::Color (class)">Color</a></tt></dt>

<dd>Takes each of this color&#8217;s RGB color channels modulo the other color&#8217;s.</dd>
</dl>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt><a href="Number.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Number.html" title="Sass::Script::Number (class)">Number</a></tt>, <tt><a href="" title="Sass::Script::Color (class)">Color</a></tt>)</span>
      
      
        <span class='name'>other</span>
      
      
      
        &mdash;
        The right-hand side of the operator
      
    </li>
  
</ul>
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt><a href="" title="Sass::Script::Color (class)">Color</a></tt>)</span>
      
      
      
      
        &mdash;
        The resulting color
      
    </li>
  
</ul>
<h3>Raises:</h3>
<ul class="raise">
  
    <li>
      
        <span class='type'>(<tt><a href="SyntaxError.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/SyntaxError.html" title="Sass::SyntaxError (class)">Sass::SyntaxError</a></tt>)</span>
      
      
      
      
        &mdash;
        if <code>other</code> is a number with units
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


481
482
483
484
485
486
487</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 481</span>

def mod(other)
  if other.is_a?(Sass::Script::Number) || other.is_a?(Sass::Script::Color)
    piecewise(other, :%)
  else
    raise NoMethodError.new(nil, :mod)
  end
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="plus-instance_method">
  
    - (<tt><a href="" title="Sass::Script::Color (class)">Color</a></tt>) <strong>plus</strong>(other) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>The SassScript <code>+</code> operation. Its functionality depends on the type of its argument:</p>

<dl>
<dt><tt><a href="Number.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Number.html" title="Sass::Script::Number (class)">Number</a></tt></dt>

<dd>Adds the number to each of the RGB color channels.</dd>

<dt><tt><a href="" title="Sass::Script::Color (class)">Color</a></tt></dt>

<dd>Adds each of the RGB color channels together.</dd>

<dt><tt><a href="Literal.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html" title="Sass::Script::Literal (class)">Literal</a></tt></dt>

<dd>See <tt><a href="Literal.html#plus-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html#plus-instance_method" title="Sass::Script::Literal#plus (method)">Literal#plus</a></tt>.</dd>
</dl>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt><a href="Literal.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Literal.html" title="Sass::Script::Literal (class)">Literal</a></tt>)</span>
      
      
        <span class='name'>other</span>
      
      
      
        &mdash;
        The right-hand side of the operator
      
    </li>
  
</ul>
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt><a href="" title="Sass::Script::Color (class)">Color</a></tt>)</span>
      
      
      
      
        &mdash;
        The resulting color
      
    </li>
  
</ul>
<h3>Raises:</h3>
<ul class="raise">
  
    <li>
      
        <span class='type'>(<tt><a href="SyntaxError.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/SyntaxError.html" title="Sass::SyntaxError (class)">Sass::SyntaxError</a></tt>)</span>
      
      
      
      
        &mdash;
        if <code>other</code> is a number with units
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


395
396
397
398
399
400
401</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 395</span>

def plus(other)
  if other.is_a?(Sass::Script::Number) || other.is_a?(Sass::Script::Color)
    piecewise(other, :+)
  else
    super
  end
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="red-instance_method">
  
    - (<tt>Fixnum</tt>) <strong>red</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>The red component of the color.</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>Fixnum</tt>)</span>
      
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


250
251
252
253</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 250</span>

def red
  hsl_to_rgb!
  @attrs[:red]
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="rgb-instance_method">
  
    - (<tt>Array&lt;Fixnum&gt;</tt>) <strong>rgb</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Returns the red, green, and blue components of the color.</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>Array&lt;Fixnum&gt;</tt>)</span>
      
      
      
      
        &mdash;
        A frozen three-element array of the red, green, and blue values (respectively) of the color
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


315
316
317</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 315</span>

def rgb
  [red, green, blue].freeze
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="saturation-instance_method">
  
    - (<tt>Numeric</tt>) <strong>saturation</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>The saturation component of the color.</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>Numeric</tt>)</span>
      
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


282
283
284
285</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 282</span>

def saturation
  rgb_to_hsl!
  @attrs[:saturation]
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="times-instance_method">
  
    - (<tt><a href="" title="Sass::Script::Color (class)">Color</a></tt>) <strong>times</strong>(other) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>The SassScript <code>*</code> operation. Its functionality depends on the type of its argument:</p>

<dl>
<dt><tt><a href="Number.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Number.html" title="Sass::Script::Number (class)">Number</a></tt></dt>

<dd>Multiplies the number by each of the RGB color channels.</dd>

<dt><tt><a href="" title="Sass::Script::Color (class)">Color</a></tt></dt>

<dd>Multiplies each of the RGB color channels together.</dd>
</dl>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt><a href="Number.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Number.html" title="Sass::Script::Number (class)">Number</a></tt>, <tt><a href="" title="Sass::Script::Color (class)">Color</a></tt>)</span>
      
      
        <span class='name'>other</span>
      
      
      
        &mdash;
        The right-hand side of the operator
      
    </li>
  
</ul>
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt><a href="" title="Sass::Script::Color (class)">Color</a></tt>)</span>
      
      
      
      
        &mdash;
        The resulting color
      
    </li>
  
</ul>
<h3>Raises:</h3>
<ul class="raise">
  
    <li>
      
        <span class='type'>(<tt><a href="SyntaxError.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/SyntaxError.html" title="Sass::SyntaxError (class)">Sass::SyntaxError</a></tt>)</span>
      
      
      
      
        &mdash;
        if <code>other</code> is a number with units
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


438
439
440
441
442
443
444</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 438</span>

def times(other)
  if other.is_a?(Sass::Script::Number) || other.is_a?(Sass::Script::Color)
    piecewise(other, :*)
  else
    raise NoMethodError.new(nil, :times)
  end
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="to_s-instance_method">
  
    - (<tt><a href="String.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/String.html" title="Sass::Script::String (class)">String</a></tt>) <strong>to_s</strong>(opts = {}) 
  

  
    <span class="aliases">Also known as:
    <span class="names"><span id='to_sass-instance_method'>to_sass</span></span>
    </span>
  
</p><div class="docstring">
  <div class="discussion">
    <p>Returns a string representation of the color. This is usually the color&#8217;s hex value, but if the color has a name that&#8217;s used instead.</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt><a href="String.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/String.html" title="Sass::Script::String (class)">String</a></tt>)</span>
      
      
      
      
        &mdash;
        The string representation
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


494
495
496
497
498
499</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 494</span>

def to_s(opts = {})
  return rgba_str if alpha?
  return smallest if options[:style] == :compressed
  return COLOR_NAMES_REVERSE[rgb] if COLOR_NAMES_REVERSE[rgb]
  hex_str
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="with-instance_method">
  
    - (<tt><a href="" title="Sass::Script::Color (class)">Color</a></tt>) <strong>with</strong>(attrs) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Returns a copy of this color with one or more channels changed. RGB or HSL colors may be changed, but not both at once.</p>

<p>For example:</p>

<pre class="code">Color.new([10, 20, 30]).with(:blue =&gt; 40)
  #=&gt; rgb(10, 40, 30)
Color.new([126, 126, 126]).with(:red =&gt; 0, :green =&gt; 255)
  #=&gt; rgb(0, 255, 126)
Color.new([255, 0, 127]).with(:saturation =&gt; 60)
  #=&gt; rgb(204, 51, 127)
Color.new([1, 2, 3]).with(:alpha =&gt; 0.4)
  #=&gt; rgba(1, 2, 3, 0.4)</pre>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt>{Symbol =&gt; Numeric}</tt>)</span>
      
      
        <span class='name'>attrs</span>
      
      
      
        &mdash;
        A map of channel names (<code>:red</code>, <code>:green</code>, <code>:blue</code>, <code>:hue</code>, <code>:saturation</code>, <code>:lightness</code>, or <code>:alpha</code>) to values
      
    </li>
  
</ul>
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt><a href="" title="Sass::Script::Color (class)">Color</a></tt>)</span>
      
      
      
      
        &mdash;
        The new Color object
      
    </li>
  
</ul>
<h3>Raises:</h3>
<ul class="raise">
  
    <li>
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
      
        &mdash;
        if both RGB and HSL keys are specified
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/script/color.rb', line 358</span>

def with(attrs)
  attrs = attrs.reject {|k, v| v.nil?}
  hsl = !([:hue, :saturation, :lightness] & attrs.keys).empty?
  rgb = !([:red, :green, :blue] & attrs.keys).empty?
  if hsl && rgb
    raise ArgumentError.new("Cannot specify HSL and RGB values for a color at the same time")
  end

  if hsl
    [:hue, :saturation, :lightness].each {|k| attrs[k] ||= send(k)}
  elsif rgb
    [:red, :green, :blue].each {|k| attrs[k] ||= send(k)}
  else
    # If we're just changing the alpha channel,
    # keep all the HSL/RGB stuff we've calculated
    attrs = @attrs.merge(attrs)
  end
  attrs[:alpha] ||= alpha

  Color.new(attrs, :allow_both_rgb_and_hsl)
end</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>
    
    <div id="footer">
  Generated on Fri Mar  8 20:34:06 2013 by 
  <a href="javascript:if(confirm(%27http://yardoc.org/  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://yardoc.org/%27" tppabs="http://yardoc.org/" title="Yay! A Ruby Documentation Tool">yard</a>
  0.5.3 (ruby-1.8.7).
</div>


  <script type="text/javascript">
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
  </script>
  <script type="text/javascript">
  try {
  var pageTracker = _gat._getTracker("UA-535380-8");
  pageTracker._trackPageview();
  } catch(err) {}</script>


  </body>
</html>